package com.yanqu.road.logic.activity.foxcard.game.effect;

import com.yanqu.road.entity.activity.foxcard.FoxHandCard;
import com.yanqu.road.logic.activity.foxcard.game.FoxCardGameLogic;
import com.yanqu.road.logic.activity.foxcard.game.eFoxCardTriggerType;

import java.util.Collections;

/**
 * 弃牌时，弃用x张人头牌加金币
 */
public class FoxCardEffect39 extends FoxCardEffectBase {
    @Override
    protected void effectHandle(FoxCardGameLogic gameLogic, FoxHandCard handCard) {
        if (triggerType != eFoxCardTriggerType.DROP) {
            return;
        }

        int numNeed = Integer.valueOf(effectConfig.getParamsList().get(0));

        int calcNum = 0;
        for (FoxHandCard dropHandCard : gameLogic.getDropHandCards()) {
            if (gameLogic.isHeardHandCard(dropHandCard)) {
                calcNum++;
            }
        }

        if (calcNum >= numNeed) {
            int goldAdd = Integer.valueOf(effectConfig.getParamsList().get(5));

            gameLogic.goldChange(goldAdd, Collections.singletonList(effectCard), null, triggerType);
        }

    }
}
